Skip to content

Conversation

@WZhuo
Copy link
Contributor

@WZhuo WZhuo commented Dec 3, 2025

No description provided.

@WZhuo WZhuo force-pushed the memory_catalog branch 4 times, most recently from 55d3900 to 67a5362 Compare December 5, 2025 07:41
Copy link
Collaborator

@zhjwpku zhjwpku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

const std::vector<std::unique_ptr<TableRequirement>>& requirements,
const std::vector<std::unique_ptr<TableUpdate>>& updates) {
return NotImplemented("update table");
std::unique_lock lock(mutex_);
Copy link
Contributor

@HuaHuaY HuaHuaY Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::unique_lock lock(mutex_);
std::lock_guard guard(mutex_);

Use std::lock_guard instead of std::unique_lock if we don't need to move the guard.

Copy link
Contributor Author

@WZhuo WZhuo Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it can be optimized with ReadWriteLock later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that we may be able to replace the lock type with std::shared_lock. If you don't do that in this PR, I hope that you can replace with std::lock_guard first. Because we have merged a PR #398 which replaced the other unique_lock in this file.

return TableMetadataFromJson(json);
}

Status TableMetadataUtil::Write(FileIO& io, const TableMetadata* base,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using reference instead of raw pointer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The base can be nullptr, indicating that this is creating a new table.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can turn metadata into reference.

/// \return The file extension of the codec.
static std::string CodecTypeToFileExtension(MetadataFileCodecType codec);

inline static constexpr std::string_view kTableMetadataFileSuffix = ".metadata.json";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static constexpr is implicitly inline and we can remove inline here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's implicitly inline in c++20+, It's recommended to explicitly define as inline in my previous PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry that I have no time last week so I didn't review your previous PR. This project is under at least C++23, so we don't need inline to avoid ODR violations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants